package com.core.dto;

import com.core.model.lxf.Account;

/**
 * Created with IntelliJ IDEA.
 * User: lxf
 * Date: 2017/1/4
 * Time: 14:45
 * To change this template use Editor | File and Code Templates.
 */
public class AccountDTO {

    public String guid;
    public String account;
    public String password;
    public String balance;

    public AccountDTO() {
    }

    public AccountDTO(String guid, String account, String balance) {
        this.guid = guid;
        this.account = account;
        this.balance = balance;
    }

    public AccountDTO(String guid, String account, String password, String balance) {
        this.guid = guid;
        this.account = account;
        this.password = password;
        this.balance = balance;
    }

    public Account toAccount(AccountDTO accountDTO) {
        Account account = new Account(accountDTO.getAccount(), Double.parseDouble(accountDTO.getBalance()), 0);
        account.setPassword("123456");
        return account;
    }

    public static AccountDTO toDTO(Account account) {
        return new AccountDTO(account.guid(), account.getAccount(), String.valueOf(account.getBalance()));
    }

    public String getGuid() {
        return guid;
    }

    public void setGuid(String guid) {
        this.guid = guid;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getBalance() {
        return balance;
    }

    public void setBalance(String balance) {
        this.balance = balance;
    }
}
